@model SampleApp.Models.CartItem

@* This partial view defines form fields that will appear when creating and editing entities *@

<div class="editor-label">
    @Html.LabelFor(model => model.Quantity)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Quantity)
    @Html.ValidationMessageFor(model => model.Quantity)
</div>

<div class="editor-label">
    Product
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.ProductId, ((IEnumerable<SampleApp.Models.Product>)ViewBag.PossibleProducts).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.Id.ToString(),
        Selected = (Model != null) && (option.Id == Model.ProductId)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.ProductId)
</div>
